<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/beetle/App/common/websocket.js"></script>
    <script language="JavaScript">

        /*function getContext() {
            var base = document.getElementsByTagName('base')[0];
            if (base && base.href && (base.href.length > 0)) {
                base = base.href;
            } else {
                base = document.URL;
            }
            var path= base.substr(0,
                    base.indexOf("/", base.indexOf("/", base.indexOf("//") + 2) + 1));

            return path.replace("http://", "ws://");
        };



        function log(message,id) {
            if(id == ''){
                var divs = document.getElementsByName("logDiv");
                for(var i=0;i<divs.length;i++){
                    divs[i].innerHTML+=message+'<br>';
                    divs[i].scrollTop = divs[i].scrollHeight;
                };
            }else{
                var console = document.getElementById("logDiv_"+id);
                if( typeof console != undefined && console != null && console != ''){
                    console.innerHTML+=message+'<br>';
                    console.scrollTop = console.scrollHeight;
                };
            }
        };


        var ws = new WebSocket(getContext()+"/test/websocket");

        ws.onopen = function () {
            log('Info: connection opened.','');
            //连接后先发送tokenId到后台绑定用户
            ws.send("tokenId:");
        };

        ws.onmessage = function (event) {
            log(event.data,'');
        }

*/
    </script>
</head>
<body>
    <div name="logDiv"></div>
</body>
</html>